home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / MC68000Test.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  3.1 KB  |  88 lines  |  [TEXT/MPS ]

  1. (*
  2.     MC68000Test.p
  3.     Pascal Interface to routines to test to see if they are running on a MC68000 Processor
  4.  
  5.     Copyright Apple Computer, Inc. 1991, 1994
  6.     All rights reserved
  7.  
  8. *)
  9.  
  10. (*$TAGS-*)
  11. (*$CALLING PASCAL*)
  12. MODULE MC68000Test;
  13.  
  14. IMPORT SYSTEM;
  15.  
  16. (*
  17. The following routines are provided to the outside caller to handle checking to see if
  18. we are runing on the “proper” processor*:
  19.  
  20. • To just do the check for the MC68000...
  21.  
  22.             PROCEDURE onMC68000*(): Boolean; C;
  23.             
  24. • To do the check for MC68000 for MPW tools and to abort with an error message to stderr
  25.     if we're on a MC68000...
  26.  
  27.             PROCEDURE abortToolOnMC68000*(exitCode: Integer); C;
  28.             
  29. • To do the check for MC68000 for MPW tools or applications and to abort with an alert
  30.     dialog if we're on a MC68000...
  31.     
  32.             PROCEDURE abortOnMC68000*; C;
  33.  
  34. If the machine is an MC68000, then abortToolOnMC68000() and abortOnMC68000() generate the
  35. following message (appropriately formatted):
  36.  
  37.     “Sorry!  This program assumes an MC68020, MC68030, or MC68040 processor.  It cannot be
  38.      run on your MC68000 machine.”
  39.  
  40. There is a possible error condition where the processor cannot be determined using the
  41. SysEnvirons() system trap (on systems older than 4.1).  In that case the following message
  42. is generated*:
  43.  
  44.     “Sorry! I cannot determine what processor you are running on!  Since this program assumes
  45.      you are running on an MC68020, MC68030, or MC68040, I am going to assume you have an
  46.      MC68000 so it cannot be run on your machine.”
  47.  
  48. Roughly, the cose of using abortToolOnMC68000() is about 750 bytes and abortOnMC68000()
  49. is about 1000 bytes.  By contrast, onMC68000, which doesn't really do much of anything
  50. costs about 100 bytes.
  51.  
  52. Note: these routines live in their own private segment, MC68000Test.  The caller might
  53. want to do an UnloadSeg() on return since these routines would normally only be called
  54. once or you may want to resegment these routines to be part of your initialization code.
  55. They were segmented seperately to allow easy unloading or resegmenting.
  56. *)
  57.  
  58. PROCEDURE onMC68000*(): BOOLEAN; (*ΔΔC;ΔΔ*)
  59.     EXTERNAL (*•• C*);
  60.     (*
  61.     This routine returns true if we are currently running on an MC68000 and false otherwise.
  62.     It is provided for convenience for those callers who wish to take some more appropriate
  63.     actions based on the processor (other than just aborting with a canned error message).
  64.     *)
  65.  
  66.  
  67. PROCEDURE abortToolOnMC68000*(exitCode: INTEGER); (*ΔΔC;ΔΔ*)
  68.     EXTERNAL (*•• C*);
  69.     (*
  70.     This routine aborts a MPW Shell tool if it's running on an MC68000 processor.  It is
  71.     assumed that we are being called by an MPW Shell tool.  It writes a message to stderr and
  72.     aborts the tool if we are on a MC68000.  The tool exit status code is specified by the
  73.     caller (in exitCode).  If 0 is specified, 1 will be used.
  74.     
  75.     If we are NOT on a MC68000, the routine simply returns to allow running of the tool.
  76.     *)
  77.  
  78.  
  79. PROCEDURE abortOnMC68000*; (*ΔΔC;ΔΔ*)
  80.     EXTERNAL (*•• C*);
  81.     (*
  82.     This routine aborts the calling program if it's running on an MC68000 processor.  The
  83.     caller can be either an MPW Shell tool OR a standard Mac application.  It displays a
  84.     message in an alert dialog and aborts if we are on a MC68000.  
  85.     *)
  86.  
  87.     END MC68000Test.
  88.